The sprite toolbox provides two functions for performing hit testing operations with sprites, SpriteWorldHitTest and SpriteHitTest .
The SpriteWorldHitTest function determines whether any sprites exist at a specified location in a sprite world's display coordinate system. This function retrieves the frontmost sprite at the specified location.
The SpriteHitTest function determines whether a particular sprite exists at a specified location in the sprite's display coordinate system. This function is useful for hit testing a subset of the sprites in a sprite world and for detecting multiple sprites at a single location.
For either hit test function, there are two flags, spriteHitTestBounds and spriteHitTestImage , that control the hit test operation. For example, you set the spriteHitTestBounds flag to check if there has been a hit anywhere within the sprite's bounding box, and you set the spriteHitTestImage flag to check if there has been a hit anywhere within the sprite image.
| Previous | Chapter Contents | Chapter Top | Next |